package com.yuanyefu.aop;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

/**
 * Created by Administrator on 2017/9/17 0017.
 */
public class LoginAroundAdvice implements MethodInterceptor {
    @Override
    public Object invoke(MethodInvocation invocation) throws Throwable {
        try {
            Object[] args = invocation.getArguments();
            if(args[0].equals("admin"))
                throw new SecurityException("Rejected");
            Object ret = invocation.proceed();

            return ret;
        }catch (Throwable t){
            throw t;
        }
    }
}
